package Interface;

/**
 *
 * @author Guilherme Silva Gomes
 * @author Ténico em informática - Semestre 2 (noite)
 * 
 */
import javax.swing.JOptionPane;
import Biblioteca.Livro;
import Biblioteca.Revista;
import OperacoesDAO.LivroDAO;
import OperacoesDAO.RevistaDAO;

public class tela extends javax.swing.JFrame {

    // Cria um form chamado tela
    public tela() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btgGrupoRadio = new javax.swing.ButtonGroup();
        txbCodigo = new javax.swing.JTextField();
        txbEdicao = new javax.swing.JTextField();
        txbNumPaginas = new javax.swing.JTextField();
        txbAno = new javax.swing.JTextField();
        txbTitulo = new javax.swing.JTextField();
        txbAutor = new javax.swing.JTextField();
        txbEditora = new javax.swing.JTextField();
        btnCadastrar = new javax.swing.JButton();
        lblCodigo = new javax.swing.JLabel();
        lblTitulo = new javax.swing.JLabel();
        lblAutor = new javax.swing.JLabel();
        lblEditora = new javax.swing.JLabel();
        lblAno = new javax.swing.JLabel();
        lblEdicao = new javax.swing.JLabel();
        lblNumPaginas = new javax.swing.JLabel();
        rdbLivro = new javax.swing.JRadioButton();
        rdbRevista = new javax.swing.JRadioButton();
        btnExcluir = new javax.swing.JButton();
        btnEditar = new javax.swing.JButton();
        btnPesquisar = new javax.swing.JButton();
        lblNumEdicao = new javax.swing.JLabel();
        lblVolume = new javax.swing.JLabel();
        lblDataEdicao = new javax.swing.JLabel();
        txbVolume = new javax.swing.JTextField();
        txbDataEdicao = new javax.swing.JTextField();
        txbNumEdicao = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        lstLivrosCad = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        lstRevistasCad = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        txbCodigo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txbCodigoActionPerformed(evt);
            }
        });

        txbEdicao.setEnabled(false);

        txbNumPaginas.setEnabled(false);

        txbAno.setEnabled(false);

        btnCadastrar.setText("Cadastrar");
        btnCadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCadastrarActionPerformed(evt);
            }
        });

        lblCodigo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblCodigo.setText("Código");

        lblTitulo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblTitulo.setText("Título");

        lblAutor.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblAutor.setText("Autor");

        lblEditora.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblEditora.setText("Editora");

        lblAno.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblAno.setText("Ano");
        lblAno.setEnabled(false);

        lblEdicao.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblEdicao.setText("Edição");
        lblEdicao.setEnabled(false);

        lblNumPaginas.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblNumPaginas.setText("Páginas");
        lblNumPaginas.setEnabled(false);

        btgGrupoRadio.add(rdbLivro);
        rdbLivro.setLabel("Livro");
        rdbLivro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbLivroActionPerformed(evt);
            }
        });

        btgGrupoRadio.add(rdbRevista);
        rdbRevista.setLabel("Revista");
        rdbRevista.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdbRevistaActionPerformed(evt);
            }
        });

        btnExcluir.setText("Excluir");

        btnEditar.setText("Editar");
        btnEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditarActionPerformed(evt);
            }
        });

        btnPesquisar.setText("Pesquisar");
        btnPesquisar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPesquisarActionPerformed(evt);
            }
        });

        lblNumEdicao.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblNumEdicao.setText("Nº Edição");
        lblNumEdicao.setEnabled(false);

        lblVolume.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblVolume.setText("Volume");
        lblVolume.setEnabled(false);

        lblDataEdicao.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblDataEdicao.setText("Data Edição");
        lblDataEdicao.setEnabled(false);

        txbVolume.setEnabled(false);

        txbDataEdicao.setEnabled(false);

        txbNumEdicao.setEnabled(false);

        lstLivrosCad.setModel(new javax.swing.AbstractListModel() {
            String[] strings = {};
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(lstLivrosCad);

        lstRevistasCad.setModel(new javax.swing.AbstractListModel() {
            String[] strings = {};
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(lstRevistasCad);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setText("Livros Cadastrados");

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setText("Revistas Cadastradas");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setText("Tipo de Publicação");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(32, 32, 32)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(lblCodigo)
                                .addComponent(lblTitulo)
                                .addComponent(lblAutor)
                                .addComponent(lblEditora))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(txbEditora, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)
                                .addComponent(txbTitulo, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)
                                .addComponent(txbAutor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)
                                .addComponent(txbCodigo, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE))
                            .addGap(60, 60, 60)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(lblAno)
                                .addComponent(lblDataEdicao)
                                .addComponent(lblNumPaginas)
                                .addComponent(lblVolume)
                                .addComponent(lblNumEdicao)
                                .addComponent(lblEdicao))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txbDataEdicao)
                                .addComponent(txbNumEdicao)
                                .addComponent(txbVolume)
                                .addComponent(txbNumPaginas)
                                .addComponent(txbAno, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)
                                .addComponent(txbEdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(60, 60, 60))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(btnCadastrar, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(btnExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(49, 49, 49)
                            .addComponent(btnEditar)
                            .addGap(18, 18, 18)
                            .addComponent(btnPesquisar)
                            .addGap(79, 79, 79)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(rdbLivro)
                        .addGap(37, 37, 37)
                        .addComponent(rdbRevista)
                        .addGap(210, 210, 210)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                        .addComponent(jScrollPane1, 0, 0, Short.MAX_VALUE))
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(25, 25, 25))
            .addGroup(layout.createSequentialGroup()
                .addGap(337, 337, 337)
                .addComponent(jLabel3)
                .addContainerGap(433, Short.MAX_VALUE))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnCadastrar, btnEditar, btnExcluir, btnPesquisar});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(rdbLivro)
                            .addComponent(rdbRevista)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(73, 73, 73)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txbCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblCodigo))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txbTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTitulo))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblAutor)
                            .addComponent(txbAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblEditora)
                            .addComponent(txbEditora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(60, 60, 60)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txbEdicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblEdicao))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txbAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblAno))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txbNumPaginas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblNumPaginas))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txbVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblVolume)))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(14, 14, 14)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txbNumEdicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblNumEdicao))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txbDataEdicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblDataEdicao))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                                    .addComponent(btnCadastrar)
                                    .addComponent(btnExcluir)
                                    .addComponent(btnEditar)
                                    .addComponent(btnPesquisar))
                                .addGap(26, 26, 26))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())))))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadastrarActionPerformed

    if (rdbLivro.isSelected() == false && rdbRevista.isSelected() == false) {
        JOptionPane.showMessageDialog(null, "Nenhum formato de publicação selecionado!");
    } else if (rdbLivro.isSelected()) {
        if ((txbCodigo.getText().isEmpty()) || (txbTitulo.getText().isEmpty()) || (txbAutor.getText().isEmpty())
                || (txbEditora.getText().isEmpty()) || (txbEdicao.getText().isEmpty()) || (txbAno.getText().isEmpty())
                || (txbNumPaginas.getText().isEmpty())) {
            JOptionPane.showMessageDialog(null, "Todos os campos devem estar preenchidos!");
        } else {
            Livro livroNovo = new Livro(Integer.parseInt(txbEdicao.getText()), Integer.parseInt(txbAno.getText()), Integer.parseInt(txbNumPaginas.getText()), txbCodigo.getText(), txbTitulo.getText(), txbAutor.getText(), txbEditora.getText());
            LivroDAO livroCad = new LivroDAO();
            livroCad.inserir(livroNovo);
            lstLivrosCad.setListData(new Object[]{livroNovo});
            JOptionPane.showMessageDialog(null, "Publicação cadastrada com sucesso!");
        }
    } else if (rdbRevista.isSelected()) {
        if ((txbCodigo.getText().isEmpty()) || (txbTitulo.getText().isEmpty()) || (txbAutor.getText().isEmpty())
                || (txbEditora.getText().isEmpty()) || (txbVolume.getText().isEmpty()) || (txbNumEdicao.getText().isEmpty())
                || (txbDataEdicao.getText().isEmpty())) {
            JOptionPane.showMessageDialog(null, "Todos os campos devem estar preenchidos!");
        } else {
            Revista revistaNova = new Revista(Integer.parseInt(txbVolume.getText()), Integer.parseInt(txbEdicao.getText()), txbDataEdicao.getText(), txbCodigo.getText(), txbTitulo.getText(), txbAutor.getText(), txbEditora.getText());
            RevistaDAO revistaCad = new RevistaDAO();
            revistaCad.inserir(revistaNova);
//            lstRevistasCad.setListData(new Object[]{revistaNova});
            lstRevistasCad.setListData(new Object[]{revistaNova});
            JOptionPane.showMessageDialog(null, "Publicação cadastrada com sucesso!");
        }
    }
}//GEN-LAST:event_btnCadastrarActionPerformed

private void rdbLivroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbLivroActionPerformed

    if (rdbLivro.isSelected()) {
        lblEdicao.setEnabled(true);
        txbEdicao.setEnabled(true);
        lblAno.setEnabled(true);
        txbAno.setEnabled(true);
        lblNumPaginas.setEnabled(true);
        txbNumPaginas.setEnabled(true);
        txbVolume.setEnabled(false);
        lblVolume.setEnabled(false);
        txbNumEdicao.setEnabled(false);
        lblNumEdicao.setEnabled(false);
        txbDataEdicao.setEnabled(false);
        lblDataEdicao.setEnabled(false);
    }
}//GEN-LAST:event_rdbLivroActionPerformed

private void txbCodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txbCodigoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txbCodigoActionPerformed

private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed

    if (rdbLivro.isSelected() == false && rdbRevista.isSelected() == false) {
        JOptionPane.showMessageDialog(null, "Nenhum formato de publicação selecionado!");
    } else if (rdbLivro.isSelected()) {
        Livro livroEdit = (Livro) lstLivrosCad.getSelectedValue();
        txbCodigo.setText(livroEdit.getCodigo());
        txbTitulo.setText(livroEdit.getTitulo());
        txbAutor.setText(livroEdit.getAutor());
        txbEditora.setText(livroEdit.getEditora());
        txbEdicao.setText((Integer.toString(livroEdit.getEdicao())));
        txbAno.setText((Integer.toString(livroEdit.getAno())));
        txbNumPaginas.setText((Integer.toString(livroEdit.getNumPaginas())));
    } else if (rdbRevista.isSelected()) {
        Livro livroEdit = (Livro) lstRevistasCad.getSelectedValue();
        txbCodigo.setText(livroEdit.getCodigo());
        txbTitulo.setText(livroEdit.getTitulo());
        txbAutor.setText(livroEdit.getAutor());
        txbEditora.setText(livroEdit.getEditora());
        txbEdicao.setText((Integer.toString(livroEdit.getEdicao())));
        txbAno.setText((Integer.toString(livroEdit.getAno())));
        txbNumPaginas.setText((Integer.toString(livroEdit.getNumPaginas())));
    }
}//GEN-LAST:event_btnEditarActionPerformed

private void rdbRevistaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbRevistaActionPerformed
// TODO add your handling code here:

    if (rdbRevista.isSelected()) {
        lblEdicao.setEnabled(false);
        txbEdicao.setEnabled(false);
        lblAno.setEnabled(false);
        txbAno.setEnabled(false);
        lblNumPaginas.setEnabled(false);
        txbNumPaginas.setEnabled(false);
        txbVolume.setEnabled(true);
        lblVolume.setEnabled(true);
        txbNumEdicao.setEnabled(true);
        lblNumEdicao.setEnabled(true);
        txbDataEdicao.setEnabled(true);
        lblDataEdicao.setEnabled(true);
    }
}//GEN-LAST:event_rdbRevistaActionPerformed

private void btnPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPesquisarActionPerformed
}//GEN-LAST:event_btnPesquisarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new tela().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup btgGrupoRadio;
    private javax.swing.JButton btnCadastrar;
    private javax.swing.JButton btnEditar;
    private javax.swing.JButton btnExcluir;
    private javax.swing.JButton btnPesquisar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblAno;
    private javax.swing.JLabel lblAutor;
    private javax.swing.JLabel lblCodigo;
    private javax.swing.JLabel lblDataEdicao;
    private javax.swing.JLabel lblEdicao;
    private javax.swing.JLabel lblEditora;
    private javax.swing.JLabel lblNumEdicao;
    private javax.swing.JLabel lblNumPaginas;
    private javax.swing.JLabel lblTitulo;
    private javax.swing.JLabel lblVolume;
    private javax.swing.JList lstLivrosCad;
    private javax.swing.JList lstRevistasCad;
    private javax.swing.JRadioButton rdbLivro;
    private javax.swing.JRadioButton rdbRevista;
    private javax.swing.JTextField txbAno;
    private javax.swing.JTextField txbAutor;
    private javax.swing.JTextField txbCodigo;
    private javax.swing.JTextField txbDataEdicao;
    private javax.swing.JTextField txbEdicao;
    private javax.swing.JTextField txbEditora;
    private javax.swing.JTextField txbNumEdicao;
    private javax.swing.JTextField txbNumPaginas;
    private javax.swing.JTextField txbTitulo;
    private javax.swing.JTextField txbVolume;
    // End of variables declaration//GEN-END:variables
}
